package ioStream.file.processStream.byteStream;

import java.io.FileOutputStream;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA
 * Description:缓冲字节输出流学习
 * User:22954
 * Date:2024-03-18
 * Time:15:18
 */
@SuppressWarnings("all")
public class BufferedOutputStream_ {
    /*
    BufferedOutputStream extends FilterOutputStream extends OutputStream
                                 protected OutputStream out
    BufferedOutputStream(OutputStream out)  包装节点流中的输出流
    =====================================================================
    close()->out.close() 关闭处理流,底层也会关闭节点流
     */
    public static void main(String[] args) {
        String filePath = "f:/Test/HELLO.txt";
        java.io.BufferedOutputStream bo = null;
        try {
            bo = new java.io.BufferedOutputStream(new FileOutputStream(filePath,true));
            String data = "hello";
            bo.write(data.getBytes());
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                bo.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
